var LifeCycle = require('./life-cycle');
var isComponent = require('./is-commmponent');
var guid=require('../utils/guid');

function Node(options) {
    this.lifeCycle = new LifeCycle();
    this.init(options || {});
}
Node.prototype._toPhase = function (name) {
    this.lifeCycle.set(name);
}
Node.prototype.init = function (options) {
    this._init(options);
}
Node.prototype._init = function (options) {
    this.own = options.owner;
    this.parent = options.parent;
    this.parentCommponent = isComponent(this.parent) ?
        this.parent :
        this.parent && this.parent.parentCommponent;
    this.scope = options.scope;
    this.aNode = this.aNode || options.aNode;
    this.el = options.el;
    this.id=(this.el&&this.el.id)
        ||(this.aNode&&this.aNode.id)
        ||guid();
}
exports = module.exports = Node;